<div class="modal-body">

    <form class="form-inline" id="goods_form_panel" onsubmit="return checkOrder(this)"  method="post">
        <if condition="$error" >
            <div class="alert alert-danger" role="alert">
                <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
                <span class="sr-only">Error:</span>
                {$error}
            </div>
        </if>
        <table class="table table-striped table-bordered table-hover table-condensed">
            <tr>
                <th width="20%">下单用户：</th>
                <td  >
                    {$model.user.username}
                </td>
                <th width="20%">下单时间：</th>
                <td  >
                    {$model.createdtime|date="Y-m-d H:i",###}
                </td>
            </tr>
            <tr>
                <th width="20%">购买产品：</th>
                <td  colspan="3" >
                    {$model.goods.name}
                    <if condition="$model.goods.type eq 0">
                        <button type="button"  class="btn btn-primary btn-xs">系统发布</button>

                    </if>
                    <if condition="$model.goods.type eq 1">
                        <button type="button"  class="btn btn-success btn-xs">用户发布</button>
                        发布用户：<button type="button"  class="btn btn-primary btn-xs">{$model.goods.username}</button>
                    </if>
                </td>
            </tr>
            <tr>
                <th width="20%">价格：</th>
                <td  >
                    ￥{$model.price}/1咖点
                </td>
                <th width="20%">数量：</th>
                <td  >
                    {$model.number}
                </td>
            </tr>
            <tr>
                <th width="20%">总价格：</th>
                <td  >
                    ￥{$model.total_price}  （<span style="color: #666">价格*数量</span>）
                </td>
                <th width="20%">总咖点：</th>
                <td  >
                    {$model.total_balance}
                </td>
            </tr>
            <tr>
                <th width="20%">单号：</th>
                <td  >
                    {$model.order_sn}
                </td>
                <th width="20%">订单状态：</th>
                <td  >
                    <if condition="$model.order_status eq '0'">
                    <span style="color: red">待支付</span>
                    </if>
                    <if condition="$model.order_status eq '1'">
                        <span style="color: green">已支付</span>
                    </if>
                    <if condition="$model.order_status eq '2'">
                        <span style="color: orangered">订单超时</span>
                        （ {$model.canceltime|date="Y-m-d H:i",###}）
                    </if>
                    <if condition="$model.order_status eq '3'">
                        <span style="color: #666">订单取消</span>
                        （ {$model.canceltime|date="Y-m-d H:i",###}）

                    </if>
                </td>
            </tr>

            <tr>
                <th width="20%">付款状态：</th>
                <td colspan="3" >
                    <if condition="$model.payment_status eq '0'">
                        <span style="color: red">未支付</span>
                    </if>
                    <if condition="$model.payment_status eq '1'">
                        <span style="color: red">已支付</span>
                        （{$model.payment_time|date="Y-m-d H:i",###}）
                    </if>
                    <if condition="$model.payment_status eq '2'">
                        <span style="color: red">支付失败</span>
                    </if>
                    <if condition="$model.payment_status eq '1'">
                        <if condition="$model.payment_type eq '1'">
                            <span style="color: green"> 微信支付  流水号：<a href="#">{$model.payment_sn}</a></span>
                        </if>
                        <if condition="$model.payment_type eq '0'">
                            <span style="color: red"> 支付宝  流水号：<a href="#">{$model.payment_sn}</a></span>
                        </if>
                    </if>
                </td>
            </tr>
            <tr>
                <th  colspan="4" width="20%">订单日志：</th>
            </tr>
            <volist name="list" id="item">
                <tr>
                    <td colspan="4"  style="width: 140px;">
                        {$item.createdtime|date="Y-m-d H:i",###}
                        <span style="color: #666">{$item.description}</span>
                    </td>
                </tr>
            </volist>
        </table>
        <div class="layer_btn_panel">
            <input type="hidden" value="{$model.id}" name="id" />
            <if condition="$model.order_status eq '0' && $model.payment_status eq '0'">
                <input type="hidden" name="order_status" value="3" />
                <button class="btn btn-sm btn-success" type="submit">取消订单</button>
            </if>
            <input class="btn btn-sm" onclick="closeIframe()" type="button" value="取消" />
        </div>
    </form>
</div>


<script>
    var type="";
    function selectuser(t){
        type=t;
        var user_id=0;
        var to_user_id=0;
        if($("#user_id_panel").val()!=""){
            user_id=parseInt($("#user_id_panel").val());
        }
        var ids=user_id;
        showIframe("{:U('/user/select')}"+"?ids="+ids+"&type="+t,(t==0?"选择用户":"选择转入用户"),"500px","500px");
    }

    function handleUser (user) {
        if(type==0){
            $("#bill_user_panel").html('<button title="可转余额：'+user.balance+'" class="btn btn-primary" type="button">\n' +
                ''+user.username+' <span class="badge">'+user.balance+'</span>\n' +
                '</button>');
            $("#kezhuan_number").html("当前可转： "+user.balance);
            $("#user_id_panel").val(user.user_id)
        }else{
            $("#bill_touser_panel").html('<a title="可转余额：'+user.balance+'" href="javascript:void(0)" >\n' +
                ''+user.username+' <span class="badge">'+user.balance+'</span>\n' +
                '</a>');
            $("#to_user_id_panel").val(user.user_id)
        }
    }
    $(function () {
        $("#goods_type").change(function () {
            $("#goods_form_panel").submit();
        })
    })

    function checkOrder(_this){
        if(confirm("您确定要取消订单吗？")){
            submitData(this);
            return true;
        }
        return false;
    }
</script>